﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CRC.GestionSalones.Controladores;

namespace CRC.GestionSalones.Presentacion
{
    public partial class AltaPresidente : DlgPersona
    {
        private IControladorCongregacion icc = null;

        public AltaPresidente()
        {
            InitializeComponent();
        }

        public AltaPresidente(IControladorCongregacion pIcc)
        {
            InitializeComponent();
            this.icc = pIcc;
        }

        public override void butOK_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text.Trim().Length == 0 ||
                txtApellido1.Text.Trim().Length == 0)
            {
                MessageBox.Show(
                    "Campos obligatorios por cumplimentar",
                    "Advertancia",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning,
                    MessageBoxDefaultButton.Button1
                );
            }
            else 
            {
                this.icc.nuevoPresidente(
                    txtNombre.Text.Trim(), 
                    txtApellido1.Text.Trim(), 
                    txtApellido2.Text.Trim(), 
                    txtTelfMovil.Text.Trim(), 
                    txtTelfFijo.Text.Trim(), 
                    txtEmail.Text.Trim()
                );
            }
        } 
    }
}
